package com.yuqiangz.boot;

import com.yuqiangz.boot.bean.Car;
import com.yuqiangz.boot.bean.UsingImportAnno;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;

/**
 * @author 赵雨强
 * @create 2021/7/23 8:35
 * @description 主程序
 */
@SpringBootApplication
@Import({UsingImportAnno.class})

public class MainApplication {
    public static void main(String[] args) {

        ConfigurableApplicationContext run = SpringApplication.run(MainApplication.class, args);

        Object user01 = run.getBean("user01");
        Object tomcatPet = run.getBean("tomcatPet");
        System.out.println(user01);
        System.out.println(tomcatPet);
        UsingImportAnno bean = run.getBean(UsingImportAnno.class);
        System.out.println(bean);
        System.out.println(run.containsBean("user02"));
        System.out.println(run.containsBean("pet02"));

        Car bean1 = run.getBean(Car.class);
        System.out.println(bean1);
    }
}
